package net.zjitc.controller;

import net.zjitc.pojo.Category;
import net.zjitc.service.CategoryService;
import net.zjitc.utils.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/category")
public class CategoryContorller {
    @Autowired
    private CategoryService categoryService;
    @RequestMapping("/list")
    @ResponseBody
    public APIResponse<Category> findAll(){
        List<Category> categorylist = categoryService.findAll();
        APIResponse apiResponse = new APIResponse();
        apiResponse.oK("查询成功",categorylist);
        return apiResponse;
    }
}
